3.15 \(\int \frac{\cos (x)}{-6+\sin (x)+\sin ^2(x)} \, dx\)

Optimal. Leaf size=21 \[ \frac{1}{5} \log (2-\sin (x))-\frac{1}{5} \log (\sin (x)+3) \]

[Out]

Log[2 - Sin[x]]/5 - Log[3 + Sin[x]]/5

________________________________________________________________________________________

Rubi [A]  time = 0.0261708, antiderivative size = 21, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 13, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.231, Rules used = {3258, 616, 31} \[ \frac{1}{5} \log (2-\sin (x))-\frac{1}{5} \log (\sin (x)+3) \]

Antiderivative was successfully verified.

[In]

Int[Cos[x]/(-6 + Sin[x] + Sin[x]^2),x]

[Out]

Log[2 - Sin[x]]/5 - Log[3 + Sin[x]]/5

Rule 3258

Int[cos[(d_.) + (e_.)*(x_)]^(m_.)*((a_.) + (b_.)*((f_.)*sin[(d_.) + (e_.)*(x_)])^(n_.) + (c_.)*((f_.)*sin[(d_.
) + (e_.)*(x_)])^(n2_.))^(p_.), x_Symbol] :> Module[{g = FreeFactors[Sin[d + e*x], x]}, Dist[g/e, Subst[Int[(1
 - g^2*x^2)^((m - 1)/2)*(a + b*(f*g*x)^n + c*(f*g*x)^(2*n))^p, x], x, Sin[d + e*x]/g], x]] /; FreeQ[{a, b, c,
d, e, f, n, p}, x] && EqQ[n2, 2*n] && IntegerQ[(m - 1)/2]

Rule 616

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[c/q, Int[1/Simp
[b/2 - q/2 + c*x, x], x], x] - Dist[c/q, Int[1/Simp[b/2 + q/2 + c*x, x], x], x]] /; FreeQ[{a, b, c}, x] && NeQ
[b^2 - 4*a*c, 0] && PosQ[b^2 - 4*a*c] && PerfectSquareQ[b^2 - 4*a*c]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rubi steps

\begin{align*} \int \frac{\cos (x)}{-6+\sin (x)+\sin ^2(x)} \, dx &=\operatorname{Subst}\left (\int \frac{1}{-6+x+x^2} \, dx,x,\sin (x)\right )\\ &=\frac{1}{5} \operatorname{Subst}\left (\int \frac{1}{-2+x} \, dx,x,\sin (x)\right )-\frac{1}{5} \operatorname{Subst}\left (\int \frac{1}{3+x} \, dx,x,\sin (x)\right )\\ &=\frac{1}{5} \log (2-\sin (x))-\frac{1}{5} \log (3+\sin (x))\\ \end{align*}

Mathematica [A]  time = 0.0089251, size = 15, normalized size = 0.71 \[ -\frac{2}{5} \tanh ^{-1}\left (\frac{1}{5} (2 \sin (x)+1)\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[x]/(-6 + Sin[x] + Sin[x]^2),x]

[Out]

(-2*ArcTanh[(1 + 2*Sin[x])/5])/5

________________________________________________________________________________________

Maple [A]  time = 0.052, size = 16, normalized size = 0.8 \begin{align*} -{\frac{\ln \left ( 3+\sin \left ( x \right ) \right ) }{5}}+{\frac{\ln \left ( \sin \left ( x \right ) -2 \right ) }{5}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)/(-6+sin(x)+sin(x)^2),x)

[Out]

-1/5*ln(3+sin(x))+1/5*ln(sin(x)-2)

________________________________________________________________________________________

Maxima [A]  time = 0.945087, size = 20, normalized size = 0.95 \begin{align*} -\frac{1}{5} \, \log \left (\sin \left (x\right ) + 3\right ) + \frac{1}{5} \, \log \left (\sin \left (x\right ) - 2\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(-6+sin(x)+sin(x)^2),x, algorithm="maxima")

[Out]

-1/5*log(sin(x) + 3) + 1/5*log(sin(x) - 2)

________________________________________________________________________________________

Fricas [A]  time = 1.37201, size = 66, normalized size = 3.14 \begin{align*} -\frac{1}{5} \, \log \left (\sin \left (x\right ) + 3\right ) + \frac{1}{5} \, \log \left (-\frac{1}{2} \, \sin \left (x\right ) + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(-6+sin(x)+sin(x)^2),x, algorithm="fricas")

[Out]

-1/5*log(sin(x) + 3) + 1/5*log(-1/2*sin(x) + 1)

________________________________________________________________________________________

Sympy [A]  time = 0.223956, size = 15, normalized size = 0.71 \begin{align*} \frac{\log{\left (\sin{\left (x \right )} - 2 \right )}}{5} - \frac{\log{\left (\sin{\left (x \right )} + 3 \right )}}{5} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(-6+sin(x)+sin(x)**2),x)

[Out]

log(sin(x) - 2)/5 - log(sin(x) + 3)/5

________________________________________________________________________________________

Giac [A]  time = 1.14793, size = 23, normalized size = 1.1 \begin{align*} -\frac{1}{5} \, \log \left (\sin \left (x\right ) + 3\right ) + \frac{1}{5} \, \log \left (-\sin \left (x\right ) + 2\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(-6+sin(x)+sin(x)^2),x, algorithm="giac")

[Out]

-1/5*log(sin(x) + 3) + 1/5*log(-sin(x) + 2)